import Vue from 'vue';
import Router from 'vue-router';
import Module1 from './module1'
import Module2 from './module2'
import Module3 from './module3'
import Module4 from './module4'
import Module5 from './module5'

Vue.use(Router);

export default new Router({
    routes: [
        {
            path: '/',
            redirect: '/dashboard'
        },
        {
            path: '/',
            component: resolve => require(['../components/common/Home.vue'], resolve),
            meta: { title: '自述文件' },
            children:[
                {
                    path: '/dashboard',
                    component: resolve => require(['../components/page/Dashboard.vue'], resolve),
                    meta: { title: '系统首页' }
                },
                {
                    path: '/icon',
                    component: resolve => require(['../components/page/Icon.vue'], resolve),
                    meta: { title: '自定义图标' }
                },
                {
                    path: '/table',
                    component: resolve => require(['../components/page/BaseTable.vue'], resolve),
                    meta: { title: '基础表格' }
                },
                {
                    path: '/tabs',
                    component: resolve => require(['../components/page/Tabs.vue'], resolve),
                    meta: { title: 'tab选项卡' }
                },
                {
                    path: '/form',
                    component: resolve => require(['../components/page/BaseForm.vue'], resolve),
                    meta: { title: '基本表单' }
                },
                {
                    // 富文本编辑器组件
                    path: '/editor',
                    component: resolve => require(['../components/page/VueEditor.vue'], resolve),
                    meta: { title: '富文本编辑器' }
                },
                {
                    // markdown组件
                    path: '/markdown',
                    component: resolve => require(['../components/page/Markdown.vue'], resolve),
                    meta: { title: 'markdown编辑器' }
                },
                {
                    // 图片上传组件
                    path: '/upload',
                    component: resolve => require(['../components/page/Upload.vue'], resolve),
                    meta: { title: '文件上传' }
                },
                {
                    // vue-schart组件
                    path: '/charts',
                    component: resolve => require(['../components/page/BaseCharts.vue'], resolve),
                    meta: { title: 'schart图表' }
                },
                {
                    // 拖拽列表组件
                    path: '/drag',
                    component: resolve => require(['../components/page/DragList.vue'], resolve),
                    meta: { title: '拖拽列表' }
                },
                {
                    // 权限页面
                    path: '/permission',
                    component: resolve => require(['../components/page/Permission.vue'], resolve),
                    meta: { title: '权限测试', permission: true }
                },
                {
                    path: '/404',
                    component: resolve => require(['../components/page/404.vue'], resolve),
                    meta: { title: '404' }
                },
                {
                    path: '/403',
                    component: resolve => require(['../components/page/403.vue'], resolve),
                    meta: { title: '403' }
                },
                //  一下为自定义路由
                {
                    path: '/module1/index',
                    component: resolve => require(['../components/module1/Index'], resolve),
                    meta: { title: '权限管理' },
                    children: Module1
                },
                {
                    path: '/module2/index',
                    component: resolve => require(['../components/module2/Index'], resolve),
                    meta: { title: '商品管理' },
                    children: Module2
                },
                {
                    path: '/module3/index',
                    component: resolve => require(['../components/module3/Index'], resolve),
                    meta: { title: '订单管理' },
                    children: Module3
                },
                {
                    path: '/module4/index',
                    component: resolve => require(['../components/module4/Index'], resolve),
                    meta: { title: '数据统计' },
                    children: Module4
                },
                {
                    path: '/module5/index',
                    component: resolve => require(['../components/module5/Index'], resolve),
                    meta: { title: '系统日志' },
                    children: Module5
                },
            ]
        },
        {
            path: '/login',
            component: resolve => require(['../components/page/Login.vue'], resolve)
        },
        // 答题用户登录
        {
            path: '/examLogin',
            component: resolve => require(['../components/page/examLogin.vue'], resolve)
        },
        // 主页
        {
            path: '/examHome',
            component: resolve => require(['../components/page/examHome.vue'], resolve)
        },
        // 答题页面
        {
            path: '/exam-error',
            component: resolve => require(['../components/page/exam-error.vue'], resolve)
        },
        {
            path: '/examList',
            component: resolve => require(['../components/page/examList.vue'], resolve)
        },
        // 答题页面
        {
            path: '/exam',
            component: resolve => require(['../components/page/exam.vue'], resolve)
        },
        // 答题完成结果页面
        {
            path: '/examDone',
            component: resolve => require(['../components/page/examDone.vue'], resolve)
        },
        {
            path: '/register',
            component: resolve => require(['../components/page/Register.vue'], resolve)
        },
        {
            path: '*',
            redirect: '/404'
        },
        {
            path: '/e',
            component: resolve => require(['../components/page/fuck.vue'], resolve)
        }
    ]
})
